package com.woniuxy.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.dao.RbacRoleDao1;
import com.woniuxy.entity.RbacRole;
import com.woniuxy.entity.ResponseEntity;
import com.woniuxy.service.RbacRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: wgt
 * Date: 2021/11/28:19:04
 * Description:
 */
@Service
public class RbacRoleServiceImpl implements RbacRoleService {
    @Autowired
    RbacRoleDao1 rbacRoleDao1;
    @Override
    public PageInfo<RbacRole> findAll(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<RbacRole> all = rbacRoleDao1.findAll();
        PageInfo page=new PageInfo(all);
          return page;
    }

    @Override
    public ResponseEntity save(RbacRole rbacRole) {
        int role = rbacRoleDao1.save(rbacRole);
        return new ResponseEntity(200,"新增成功",role);
    }

    @Override
    public ResponseEntity deleteById(int id) {
        int role = rbacRoleDao1.deleteById(id);
        return new ResponseEntity(200,"删除成功",role);
    }

    @Override
    public ResponseEntity update(RbacRole rbacRole) {
        int role = rbacRoleDao1.update(rbacRole);
        return new ResponseEntity(200,"修改成功",role);
    }
}
